package com.hrl.dao;

import com.hrl.domain.User;
import com.hrl.util.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class UserDao {

    public User login(String name, String password) throws SQLException {
        QueryRunner qr = new QueryRunner(DruidUtils.getDataSource());
        String sql="select * from userinfo where username = ? and password = ?";
        User user = qr.query(sql, new BeanHandler<User>(User.class), name, password);

        return user;
    }
}
